'\" te
.\"  Copyright (c) 2006, Sun Microsystems, Inc.,  All Rights Reserved
.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
.TH SCSI_TRANSPORT 9F "Jan 16, 2006"
.SH NAME
scsi_transport \- request by a SCSI target driver to start a command
.SH SYNOPSIS
.nf
#include <sys/scsi/scsi.h>



\fBint\fR \fBscsi_transport\fR(\fBstruct scsi_pkt *\fR\fIpkt\fR);
.fi

.SH INTERFACE LEVEL
illumos DDI specific (illumos DDI).
.SH PARAMETERS
.ne 2
.na
\fB\fIpkt\fR\fR
.ad
.RS 7n
Pointer to a \fBscsi_pkt\fR(9S) structure.
.RE

.SH DESCRIPTION
Target drivers use \fBscsi_transport()\fR to request the host adapter driver to
transport a command to the \fBSCSI \fRtarget device specified by \fIpkt\fR. The
target driver must obtain resources for the packet using
\fBscsi_init_pkt\fR(9F) prior to calling this function. The packet may be
initialized using one of the \fBmakecom\fR(9F) functions.
\fBscsi_transport()\fR does not wait for the \fBSCSI\fR command to complete.
See \fBscsi_poll\fR(9F) for a description of polled \fBSCSI\fR commands. Upon
completion of the \fBSCSI\fR command the host adapter calls the completion
routine provided by the target driver in the \fBpkt_comp\fR member of the
\fBscsi_pkt\fR pointed to by \fIpkt\fR.
.SH RETURN VALUES
The \fBscsi_transport()\fR function returns:
.sp
.ne 2
.na
\fB\fBTRAN_ACCEPT\fR\fR
.ad
.RS 20n
The packet was accepted by the transport layer.
.RE

.sp
.ne 2
.na
\fB\fBTRAN_BUSY\fR\fR
.ad
.RS 20n
The packet could not be accepted because there was already a packet in progress
for this target/lun, the host adapter queue was full, or the target device
queue was full.
.RE

.sp
.ne 2
.na
\fB\fBTRAN_BADPKT\fR\fR
.ad
.RS 20n
The \fBDMA\fR count in the packet exceeded the \fBDMA\fR engine's maximum
\fBDMA\fR size.
.RE

.sp
.ne 2
.na
\fB\fBTRAN_FATAL_ERROR\fR\fR
.ad
.RS 20n
A fatal error has occurred in the transport layer.
.RE

.SH CONTEXT
The \fBscsi_transport()\fR function can be called from user, interrupt, or
kernel context.
.SH EXAMPLES
\fBExample 1 \fRUsing \fBscsi_transport()\fR
.sp
.in +2
.nf
if ((status = scsi_transport(rqpkt)) != TRAN_ACCEPT) {
      scsi_log(devp, sd_label, CE_WARN,
          "transport of request sense pkt fails (0x%x)\en", status);
}
.fi
.in -2

.SH SEE ALSO
.BR tran_start (9E),
.BR makecom (9F),
.BR scsi_init_pkt (9F),
.BR scsi_pktalloc (9F),
.BR scsi_poll (9F),
.BR scsi_pkt (9S)
.sp
.LP
\fIWriting Device Drivers\fR
